var AUTO;
(function (AUTO) {
    var AutoTable = (function () {
        function AutoTable(element, options) {
            this._opt = {
                data: [],
                prefix: '',
                isRownumber: false,
                header: [],
                header2: [],
                headerFields: [],
                header2Fields: [],
                isFooter: true,
                zeroShowAs: '0',
                nullShowAs: '',
                isPageable: false,
                pageNumber: 1,
                pageSize: 20,
                pageSizeList: [10, 20, 50, 100],
                sortFields: [],
                mergeFields: [],
                columnsWidths: [],
                isScrollable: false,
                freezeFields: [],
                freezeContainer: window,
                isSelectable: false,
                selectMulti: true,
                columns: {},
                tooltipOnRow: null,
                keydataOnRow: [],
                editUrl: '',
                editTable: '',
                editKeyFields: [],
                editFields: [],
                editOn: null,
                editBeforeUpload: null,
                filter: null,
                isAnalyse: false,
                isSaveable: false,
                saveURL: "",
                initClass: "table table-striped table-bordered table-condensed table-hover"
            };
            this.prefix = "";
            this.thead = "";
            this.tbody = "";
            this.tfoot = "";
            this.thead2 = "";
            this.tbody2 = "";
            this.tcolgroup = "";
            this.sortInfo = {};
            this.hidedFields = [];
            this.me = $(element);
            this._opt = $.extend(this._opt, options);
            this.prefix = (this._opt.prefix || this.me.attr("id") || ("auto")) + "_";
            this.init();
            this.render();
            this.LastInsert();
            this.bindEvents();
            this.me.data('OriginData', this).trigger('loaded');
        }
        AutoTable.prototype.render = function () {
            this.renderThead();
            this.renderTfoot();
            this.renderTbody();
            if (this._opt.header2Fields.length > 0) {
                this.renderThead(2);
                this.renderTbody(2);
            }
        };
        AutoTable.prototype.reloadTbodyTfoot = function () {
            this.render();
            this.LastInsert();
            if (this._opt.isScrollable)
                this.tContainer.trigger("scroll");
            this.me.trigger("reloaded");
        };
        AutoTable.prototype.LastInsert = function () {
            this.me[0].innerHTML = this.tcolgroup + this.tbody + this.thead2 + this.tbody2 + this.thead + this.tfoot;
            this.findDoms();
            this.readHeader();
            if (this.hidedFields.length > 0) {
                this.me.trigger("hide", this.hidedFields.join(","));
            }
        };
        AutoTable.prototype.init = function () {
            if (this.me.hasClass(AutoTable.DefaultClassName)) {
                this.me.off(AutoTable.DefaultEventNamespace);
            }
            else {
                this.me.addClass(AutoTable.DefaultClassName + " " + this._opt.initClass);
            }
            this.tContainer = $(this._opt.freezeContainer);
            if (this._opt.columnsWidths.length) {
                var cols_1 = "";
                _.each(this._opt.columnsWidths, function (w) {
                    cols_1 += "<col width=\"" + w + "px\" />";
                });
                this.tcolgroup = cols_1;
            }
            if (!_.isArray(this._opt.data)) {
                $.auto.alert("错误", "传入的数据不是数组，请检查！");
                return;
            }
            this.showData = _.isFunction(this._opt.filter) ?
                _.filter(this._opt.data, this._opt.filter) :
                this._opt.data;
            this.rowCount = this.showData.length;
            if (this._opt.data.length) {
                if (this._opt.headerFields.length == 0) {
                    for (var key in this._opt.data[0])
                        this._opt.headerFields.push(key);
                }
                if (this._opt.header.length == 0) {
                    var arrHead = [];
                    for (var key in this._opt.data[0])
                        arrHead.push({ title: key, span: [] });
                    this._opt.header.push(arrHead);
                }
            }
            if (this._opt.isRownumber) {
                if (this._opt.headerFields.indexOf(AutoTable.DefaultRownumID) == -1) {
                    this._opt.headerFields.unshift(AutoTable.DefaultRownumID);
                    if (this._opt.header2Fields.length)
                        this._opt.header2Fields.unshift(AutoTable.DefaultRownumID);
                }
            }
            this.colunmsCount = this._opt.headerFields.length;
            if (this._opt.editFields.length > 0 &&
                this._opt.editKeyFields.length > 0 &&
                this._opt.editUrl != '' &&
                this._opt.editTable != '') {
                this.isEditable = true;
                this.me.css('table-layout', 'fixed');
            }
        };
        AutoTable.prototype.createTh = function (thOpt) {
            if (thOpt._cache)
                return thOpt._cache;
            var th = '', th_attr = '', th_text = '';
            var arr = thOpt.title.split("|");
            if (arr[1]) {
                if (_.includes(this._opt.sortFields, arr[1])) {
                    th_text += "<a class='autoSort' data-field=" + arr[1] + ">" + arr[0] + "</a> ";
                }
                else {
                    th_text += arr[0];
                }
                th_attr += "id=\"" + (this.prefix + arr[1]) + "\" data-field=\"" + arr[1] + "\" ";
            }
            else {
                th_text += arr[0];
            }
            (thOpt.span[0] && thOpt.span[0] != 1) && (th_attr += "colspan=\"" + thOpt.span[0] + "\" ");
            (thOpt.span[1] && thOpt.span[1] != 1) && (th_attr += "rowspan=\"" + thOpt.span[1] + "\" ");
            (thOpt.span[2]) && (th_attr += thOpt.span[2]);
            th = "<th " + th_attr + ">" + th_text + "</th>";
            thOpt._cache = th;
            return th;
        };
        AutoTable.prototype.renderThead = function (flag) {
            if (flag === void 0) { flag = 1; }
            var scope = this;
            var headeropt = flag == 1 ? this._opt.header : this._opt.header2;
            if (!_.isArray(headeropt[0])) {
                var header_1 = [];
                _.each(headeropt, function (old_row) {
                    var row = [];
                    _.map(old_row, function (v, k) {
                        row.push({ title: k, span: v });
                    });
                    header_1.push(row);
                });
                if (flag == 1) {
                    this._opt.header = header_1;
                }
                else {
                    this._opt.header2 = header_1;
                }
                headeropt = header_1;
            }
            var trs = '';
            _.each(headeropt, function (row) {
                var ths = '';
                _.each(row, function (thOpt) {
                    ths += scope.createTh(thOpt);
                });
                if (flag == 1) {
                    trs += "<tr>" + ths + "</tr>";
                }
                else {
                    trs += "<tr class=\"autoheader2\">" + ths + "</tr>";
                }
            });
            if (flag == 1)
                scope.thead = "<thead>" + trs + "</thead>";
            else
                scope.thead2 = trs;
        };
        AutoTable.prototype.createTR = function (row, rowidx, vMerge, end, flag) {
            if (flag === void 0) { flag = 1; }
            var scope = this;
            var tr = '', tr_attr = '', tds = '';
            this._opt.tooltipOnRow && (tr_attr += "title=\"" + this._opt.tooltipOnRow(row) + "\" ");
            if (this._opt.keydataOnRow) {
                _.each(this._opt.keydataOnRow, function (key) {
                    tr_attr += "data-" + key + "=\"" + row[key] + "\" ";
                });
            }
            var headerfield = flag == 1 ? this._opt.headerFields : this._opt.header2Fields;
            _.each(headerfield, function (field, idx) {
                var td_attr = '', td_text = '', td_class = '';
                td_class += (scope.prefix + field);
                if (_.includes(scope._opt.mergeFields, field)) {
                    if (row[field] != null) {
                        if (row[field] == vMerge[field]) {
                            return;
                        }
                        else {
                            vMerge[field] = row[field];
                            var rowspan = 1;
                            while ((rowidx + rowspan) <= end) {
                                if (scope.showData[rowidx + rowspan][field] == vMerge[field])
                                    rowspan++;
                                else
                                    break;
                            }
                            rowspan > 1 && (td_attr += "rowspan=\"" + rowspan + "\" ");
                        }
                    }
                    else {
                        vMerge[field] = row[field];
                    }
                }
                var curColumn = scope._opt.columns[field];
                var value = row[field];
                if (curColumn && _.isFunction(curColumn.formator)) {
                    value = curColumn.formator(value, row);
                }
                else {
                    value = (value == 0 ? scope._opt.zeroShowAs : (value || scope._opt.nullShowAs));
                }
                scope._opt.freezeFields.indexOf(field) >= 0 && (td_class += (" " + AutoTable.DefaultFreezeClassName));
                td_attr += "data-index=\"" + idx + "\" ";
                if (curColumn && _.isFunction(curColumn.tooltip)) {
                    td_attr += "title=\"" + curColumn.tooltip(row[field], row) + "\" ";
                }
                if (scope.isEditable &&
                    (scope._opt.editOn == null || ((_.isFunction(scope._opt.editOn)) && scope._opt.editOn(field, row))) &&
                    _.includes(scope._opt.editFields, field)) {
                    var kv_1 = {};
                    _.each(scope._opt.editKeyFields, function (f) {
                        kv_1[f] = row[f];
                    });
                    td_text += ("<input class=\"" + AutoTable.DefaultEditClassName + "\" value=\"" + value + "\" data-field=\"" + field + "\" data-kv='" + JSON.stringify(kv_1) + "' data-old=\"" + value + "\" />");
                }
                else {
                    td_text += value;
                }
                tds += "<td class=\"" + td_class + "\"  " + td_attr + ">" + td_text + "</td>";
            });
            tr = "<tr " + tr_attr + ">" + tds + "</tr>";
            row._cache = tr;
            return tr;
        };
        AutoTable.prototype.renderTbody = function (flag) {
            if (flag === void 0) { flag = 1; }
            var scope = this;
            var trs = '';
            var trs2 = '';
            var start = 0, end = this.showData.length - 1;
            if (end < 0)
                return;
            if (this._opt.isPageable) {
                start = (this._opt.pageNumber - 1) * this._opt.pageSize;
                end = Math.min(this._opt.pageNumber * this._opt.pageSize - 1, end);
            }
            var vMerge1 = {}, vMerge2 = {};
            _.each(this.showData, function (row, ridx) {
                if (ridx >= start && ridx <= end) {
                    row[AutoTable.DefaultRownumID] = ridx + 1;
                    trs += scope.createTR(row, ridx, vMerge1, end);
                    if (scope._opt.header2Fields.length > 0) {
                        trs2 += scope.createTR(row, ridx, vMerge2, end, 2);
                    }
                }
            });
            scope.tbody = "<tbody>" + trs + "</tbody>";
            scope.tbody2 = trs2;
        };
        AutoTable.prototype.renderTfoot = function () {
            if (!this._opt.isFooter)
                return;
            var scope = this;
            var td_attr = "", td_text = "";
            var options = '', btn1 = '', btn2 = '';
            td_attr += ("colspan=\"" + this.colunmsCount + "\" ");
            if (this._opt.isPageable) {
                this.pageCount = Math.floor((this.rowCount + this._opt.pageSize - 1) / this._opt.pageSize);
                _.each(this._opt.pageSizeList, function (psl) {
                    options += "<option  " + (psl == scope._opt.pageSize ? 'selected="true"' : '') + ">" + psl + "</option>";
                });
                options += '<option value="all">全部</option>';
                td_text += ("<span>\u6BCF\u9875<select class=\"psSelect\">" + options + "</select>\u6761</span>");
                options = '';
                for (var i = 1; i <= this.pageCount; i++) {
                    options += (i == scope._opt.pageNumber) ? "<option selected=\"true\">" + i + "</option>" : "<option>" + i + "</option>";
                }
                td_text += ("<span>\u8DF3\u8F6C<select class=\"pnSelect\">" + options + "</select>\u9875</span>");
                btn1 = "<button type=\"button\" class=\"btn btn-default btn-xs\" data-flag=\"prepage\" " + (this._opt.pageNumber == 1 ? "disabled" : "") + ">\u4E0A\u4E00\u9875</button>";
                btn2 = "<button type=\"button\" class=\"btn btn-default btn-xs\" data-flag=\"nextpage\" " + (this._opt.pageNumber == this.pageCount ? "disabled" : "") + ">\u4E0B\u4E00\u9875</button>";
                td_text += ("<div class=\"btn-group autoPager\">" + btn1 + btn2 + "</div>");
            }
            else {
                td_text += '<button type="button" class="btn btn-default btn-xs" data-flag="paging">启用分页</button>';
            }
            if (this._opt.isSaveable) {
                td_text += "<button type=\"button\"  class=\"btn btn-default btn-xs " + AutoTable.DefaultSaveButtonClassName + "\" >\u5BFC\u51FA</button>";
            }
            this.tfoot = "<tfoot><td " + td_attr + ">" + td_text + "</td></tfoot>";
        };
        AutoTable.prototype.findDoms = function () {
            if (this.isEditable) {
                this.allEditInput = this.me.find("." + AutoTable.DefaultEditClassName);
                this.bindEdit();
            }
            if (this._opt.isScrollable) {
                this.frzHead = this.me.find("thead th");
                this.frzTd = this.me.find("." + AutoTable.DefaultFreezeClassName);
            }
            this.allTheadrows = this.me.find("thead>tr");
            if (this._opt.header2Fields.length > 0) {
                this.allTheadrows = this.allTheadrows.add(this.me.find(".autoheader2"));
            }
        };
        AutoTable.prototype.readHeader = function () {
            var scope = this;
            var pos = [[], [], [], [], [], [], [], [], [], []];
            var x = 0, y = 0;
            var thInCol = [];
            var tmp1, tmp2;
            this.allTheadrows.each(function (iTR, tr) {
                $(tr).find('th').each(function (iTH, th) {
                    var c = th.colSpan, r = th.rowSpan;
                    for (tmp1 = 0; tmp1 < c; tmp1++) {
                        for (tmp2 = 0; tmp2 < r; tmp2++) {
                            while (typeof pos[y + tmp2][x + tmp1] !== 'undefined') {
                                x++;
                            }
                            pos[y + tmp2][x + tmp1] = th;
                        }
                        thInCol[x + tmp1] = thInCol[x + tmp1] || [];
                        thInCol[x + tmp1].push(th);
                    }
                    x = x + th.colSpan;
                });
                x = 0;
                y++;
            });
            scope.fieldDict = {};
            $.each(this._opt.headerFields, function (i, field) {
                scope.fieldDict[field] = {
                    index: i,
                    ths: thInCol[i]
                };
            });
            $.each(this._opt.header2Fields, function (i, field) {
                scope.fieldDict[field] = {
                    index: i,
                    ths: thInCol[i]
                };
            });
        };
        AutoTable.prototype.hideCol = function (field) {
            var fdict = this.fieldDict[field];
            var hidTD = this.me.find("tbody [data-index=" + fdict.index + "]");
            fdict.width = hidTD.width();
            _.each(fdict.ths, function (th) {
                if (th.colSpan > 1)
                    th.colSpan--;
                else
                    $(th).hide();
            });
            hidTD.hide();
            if (!_.isEmpty(this._opt.columnsWidths)) {
                this.me.find("colgroup col:nth-child(" + fdict.index + ")").hide();
            }
            this.me.width(this.me.width() - fdict.width);
        };
        AutoTable.prototype.showCol = function (field) {
            var fdict = this.fieldDict[field];
            _.each(fdict.ths, function (th) {
                if ($(th).is(':visible'))
                    th.colSpan++;
                else
                    $(th).show();
            });
            var hidTD = this.me.find("tbody [data-index=" + fdict.index + "]");
            hidTD.show();
            if (!_.isEmpty(this._opt.columnsWidths)) {
                this.me.find("colgroup col:nth-child(" + fdict.index + ")").show();
            }
            this.me.width(this.me.width() + fdict.width);
        };
        AutoTable.prototype.bindEvents = function () {
            var scope = this;
            if (this._opt.isSelectable) {
                this.me.on('click' + AutoTable.DefaultEventNamespace, 'tbody>tr', function (e) {
                    if (!$(e.target).is('input')) {
                        if (!scope._opt.selectMulti && (!$(this).hasClass(AutoTable.DefaultSelectedClassName))) {
                            scope.me.find("." + AutoTable.DefaultSelectedClassName).removeClass(AutoTable.DefaultSelectedClassName);
                        }
                        $(this).toggleClass(AutoTable.DefaultSelectedClassName);
                    }
                });
            }
            this.me.on('change' + AutoTable.DefaultEventNamespace, 'tfoot select', function (e) {
                var $sel = $(this);
                if ($sel.hasClass("psSelect")) {
                    if ($sel.val() == "all") {
                        scope._opt.isPageable = false;
                    }
                    else {
                        scope._opt.pageSize = parseInt($sel.val());
                        scope._opt.pageNumber = 1;
                    }
                }
                else if ($sel.hasClass("pnSelect")) {
                    scope._opt.pageNumber = parseInt($sel.val());
                }
                scope.reloadTbodyTfoot();
            });
            this.me.on('click' + AutoTable.DefaultEventNamespace, 'tfoot button', function (e) {
                var $sel = $(this);
                if ($sel.data("flag") == "prepage") {
                    scope._opt.pageNumber--;
                }
                else if ($sel.data("flag") == "nextpage") {
                    scope._opt.pageNumber++;
                }
                else if ($sel.data("flag") == "paging") {
                    scope._opt.pageNumber = 1;
                    scope._opt.isPageable = true;
                }
                scope.reloadTbodyTfoot();
            });
            this.me.on('click' + AutoTable.DefaultEventNamespace, 'thead .autoSort,.autoheader2 .autoSort', function (e) {
                var field = $(this).data("field");
                var direction = scope.sortInfo[field];
                direction = _.isUndefined(direction) ? true : (!direction);
                scope.sortInfo[field] = direction;
                scope.showData = _.orderBy(scope.showData, [field], direction ? ["asc"] : ["desc"]);
                scope._opt.pageNumber = 1;
                scope.reloadTbodyTfoot();
            });
            if (scope._opt.isScrollable) {
                scope.tContainer.on("scroll" + AutoTable.DefaultEventNamespace, function () {
                    var top = scope.tContainer.scrollTop();
                    var left = scope.tContainer.scrollLeft();
                    scope.frzHead.css({ "transform": "translate(0," + top + "px)" });
                    scope.frzTd.css({ "transform": "translate(" + left + "px,0)" });
                });
            }
            this.me.on('hide' + AutoTable.DefaultEventNamespace, function (e, fields) {
                if (typeof fields == 'undefined')
                    return;
                var fArr = fields.split(',');
                _.each(fArr, function (f) {
                    if (((_.includes(scope._opt.headerFields, f)) || _.includes(scope._opt.header2Fields, f)) &&
                        (!_.includes(scope.hidedFields, f)) &&
                        (!_.includes(scope._opt.freezeFields, f))) {
                        scope.hidedFields.push(f);
                        scope.hideCol(f);
                    }
                });
            });
            this.me.on('show' + AutoTable.DefaultEventNamespace, function (e, fields) {
                if (typeof fields == 'undefined')
                    return;
                var fArr = fields.split(',');
                _.each(fArr, function (f) {
                    if (_.includes(scope.hidedFields, f)) {
                        var idx_f = _.indexOf(scope.hidedFields, f);
                        scope.hidedFields.splice(idx_f, 1);
                        scope.showCol(f);
                    }
                });
            });
            if (this._opt.isSaveable) {
                this.me.on('export' + AutoTable.DefaultEventNamespace, function () {
                    scope.ExportData();
                });
                this.me.on('click' + AutoTable.DefaultEventNamespace, '.' + AutoTable.DefaultSaveButtonClassName, function () {
                    scope.ExportData();
                });
            }
        };
        AutoTable.prototype.bindEdit = function () {
            if (this.isEditable) {
                var scope_1 = this;
                this.allEditInput.blur(function (e) {
                    var $input = $(this);
                    var field = $input.data("field"), kv = $input.data("kv"), old = $input.data("old"), v = $.trim($input.val());
                    if (v == old)
                        return;
                    var upKv = _.clone(kv);
                    upKv[field] = v;
                    upKv['old_' + field] = old;
                    upKv["_TABLE"] = scope_1._opt.editTable;
                    upKv["_FIELD"] = field;
                    if (_.isNull(scope_1._opt.editBeforeUpload) || (_.isFunction(scope_1._opt.editBeforeUpload) && scope_1._opt.editBeforeUpload(upKv, field))) {
                        scope_1.me.trigger('beforeCellEdited', [upKv, $input]);
                        $.ajax(scope_1._opt.editUrl, {
                            cache: false, type: 'POST',
                            data: upKv, dataType: 'json' }).done(function (ret) {
                            $input.data('old', v);
                            _.find(scope_1.showData, function (row) {
                                if (_.isMatch(row, kv)) {
                                    row[field] = v;
                                    return true;
                                }
                                return false;
                            });
                            $input.addClass(AutoTable.DefaultCellEdited);
                            scope_1.me.trigger('cellEdited', [upKv, $input]);
                            scope_1.me.trigger('afterCellEdited', [upKv, $input, true]);
                        }).fail(function (XMLHttpRequest, textStatus, errorThrown) {
                            $input.val(old);
                            scope_1.me.trigger('afterCellEdited', [upKv, $input, false]);
                        });
                    }
                });
                this.me.on('keydown' + AutoTable.DefaultEventNamespace, '.' + AutoTable.DefaultEditClassName, function (event) {
                    var newinput = null;
                    if (event.keyCode == 13 || event.keyCode == 39) {
                        var idx = scope_1.allEditInput.index(this);
                        if (idx < scope_1.allEditInput.length - 1)
                            newinput = $(scope_1.allEditInput[idx + 1]);
                    }
                    if (event.keyCode == 37) {
                        newinput = scope_1.allEditInput.prev();
                        var idx = scope_1.allEditInput.index(this);
                        if (idx > 0)
                            newinput = $(scope_1.allEditInput[idx - 1]);
                    }
                    if (event.keyCode == 38) {
                        var field = $(this).data('field');
                        var list = scope_1.allEditInput.filter("[data-field='" + field + "']");
                        var idx = list.index(this);
                        if (idx > 0)
                            newinput = $(list[idx - 1]);
                    }
                    if (event.keyCode == 40) {
                        var field = $(this).data('field');
                        var list = scope_1.allEditInput.filter("[data-field='" + field + "']");
                        var idx = list.index(this);
                        if (idx < list.length - 1)
                            newinput = $(list[idx + 1]);
                    }
                    if (newinput) {
                        newinput.selectWord();
                        !_.isUndefined(newinput[0].scrollIntoView) || newinput[0].scrollIntoView();
                        return false;
                    }
                    return true;
                }).on("paste" + AutoTable.DefaultEventNamespace, "." + AutoTable.DefaultEditClassName, function (event) {
                    event.stopPropagation();
                    event.preventDefault();
                    var origEvent = event.originalEvent;
                    var cd = origEvent.clipboardData || window.clipboardData;
                    if (!cd)
                        return;
                    var content = cd.getData("text");
                    var rows = content.indexOf('\r\n') == -1 ? content.split('\n') : content.split('\r\n');
                    if ($.trim(rows.slice(-1)[0]) == '') {
                        rows.pop();
                    }
                    var xpos = $(this);
                    var ypos = $(this);
                    var field = xpos.data('field');
                    $.each(rows, function (i, r) {
                        xpos = ypos;
                        var cols = r.split('\t');
                        $.each(cols, function (j, c) {
                            xpos.val($.trim(c)).focus().blur();
                            var idx = scope_1.allEditInput.index(xpos);
                            if (idx < scope_1.allEditInput.length - 1) {
                                xpos = $(scope_1.allEditInput[idx + 1]);
                            }
                            else {
                                return;
                            }
                        });
                        var list = scope_1.allEditInput.filter("[data-field='" + field + "']");
                        var index = list.index(ypos);
                        if (index < list.length - 1)
                            ypos = $(list[index + 1]);
                        else
                            return;
                    });
                });
            }
        };
        AutoTable.prototype.ExportData = function () {
            var scope = this;
            var cloneOpt = $.extend(true, {}, this._opt);
            var showData = $.extend(true, {}, this.showData);
            var uData = _.pick(cloneOpt, "header", "header2", "headerFields", "header2Fields");
            var allfield = _.uniq(cloneOpt.header2Fields.concat(cloneOpt.headerFields));
            var rownum = 1;
            _.each(showData, function (row) {
                _.each(allfield, function (key) {
                    if (key == "rownum")
                        row[key] = rownum++;
                    else {
                        if (scope._opt.columns[key] && _.isFunction(scope._opt.columns[key].formator)) {
                            row[key] = scope._opt.columns[key].formator(row[key], row);
                            if (row[key] == null) {
                                row[key] = "";
                            }
                            else {
                                row[key] = row[key].replace(/<[^>]+>/g, "");
                            }
                        }
                        else
                            row[key] = (row[key] === 0 ? scope._opt.zeroShowAs : (row[key] || scope._opt.nullShowAs));
                    }
                });
            });
            uData.showData = showData;
            var $iframe = $('<iframe />');
            var $form = $('<form target="down-file-iframe" method="post" />');
            $form.attr('action', this._opt.saveURL);
            var size = 84555;
            var content = JSON.stringify(uData);
            var d = 1;
            while (content.length > 0) {
                $form.append("<input  name='d" + d + "' value='" + content.slice(0, size) + "' />");
                content.slice(size);
                d++;
            }
            $iframe.append($form);
            $(document.body).append($iframe);
            $form[0].submit();
            $iframe.remove();
        };
        AutoTable.DefaultClassName = "autotable";
        AutoTable.DefaultEditClassName = "autoEdit";
        AutoTable.DefaultFreezeClassName = "frzTD";
        AutoTable.DefaultEventNamespace = ".autoTableEvent";
        AutoTable.DefaultSelectedClassName = "autoselected";
        AutoTable.DefaultSaveButtonClassName = "autoSave";
        AutoTable.DefaultCellEdited = 'cellEdited';
        AutoTable.DefaultRownumID = "_rownum";
        return AutoTable;
    }());
    AUTO.AutoTable = AutoTable;
})(AUTO || (AUTO = {}));
